<?php
namespace app\erp_meixingtiyu\model;

use think\Model;
use app\common\model\UploadFile;

class Contact extends Model
{
    protected $table = 'athlon_contact';
    protected $pk = 'nid';

    public function image()
    {
        return $this->hasOne(UploadFile::class, 'file_id', 'image_id');
    }

    public static function getInfo()
    {
      return self::with('image')->where('nid', 0)->find();
    }

    public static function updateInfo($data)
    {
      return self::update(array_merge($data, ['nid' => 0]));
    }
}
